import {request} from '@/utils/request'

const apiUrl = '/api/v1/alarm/'
const apiConfig = '/api/v1/alarmconfig'
//预警信息
export function list(id) {
  return request({
    url: `${apiUrl}list/${id}`,
    method: 'post'
  })
}

//删除单条预警
export function alarmDel(id) {
  return request({
    url: `${apiUrl}${id}`,
    method: 'delete'
  })
}

//根据告警规则删除告警
export function alarmDelByRule(id) {
  return request({
    url: `${apiUrl}delByRule/${id}`,
    method: 'delete'
  })
}

//预警规则
export function configList(id) {
  return request({
    url: `${apiConfig}/list/${id}`,
    method: 'get'
  })
}

//修改规则
export function configEdit(data) {
  return request({
    url: apiConfig,
    method: 'put',
    data
  })
}

//添加规则
export function configAdd(data) {
  return request({
    url: apiConfig,
    method: 'post',
    data
  })
}

//删除规则
export function configDel(id) {
  return request({
    url: `${apiConfig}/${id}`,
    method: 'delete'
  })
}
